<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<div id="onDiv">
	<div id="onInputDiv">
		订单id:<input type="text" id="reserveId"><br>
		订单密码：<input type="text" id="reservePass"><br>
		<button id="onResBut">提交</button>
	</div>
	<div id="reserveInforDiv">
		订单编号:<label id="onOrderId"></label><br>
		总金额:<label id="onCost"></label><br>
		房间名称:<label id="onRoomName"></label><br>
		预定入住日期:<label id="onOriInDate"></label><br>
		预定离店日期:<label id="onOutDate"></label><br>
		联系电话:<input type="text" id="resPhone"><br>
		身份证号:<input type="text" id="resIdCardNo"><br>
		备注:<textarea cols='20' rows='20' id='resComment'></textarea><br>
		<button id='onCheckBut'>入住</button>&nbsp;&nbsp;<button id='onCancelBut'>取消</button>
	</div>
</div>
<style>
	#reserveInforDiv{
		display:none;
	}
</style>
<script>
$("#onResBut").click(function(){
	$.post("/hotel/checkIn/getReserve",{'id':$("#reserveId").val(),'password':$("#reservePass").val()},function(str){
		var res=eval('(' +str + ')')
		if(res.code!=0){
			alert(res.message)
			return;
		}else{
			res=res.object
			$('#onInputDiv').css('display','none')
			$('#reserveInforDiv').css('display','block')
			$('#onOrderId').text(res.orderId)
			$('#onRoomName').text(res.roomName)
			$('#onCost').text(res.price)
			$('#onOriInDate').text(res.inDate)
			$('#onOutDate').text(res.outDate)
			$('#resPhone').val(res.phone)
			$('#resComment').val(res.zcomment)
		}
	})
})
	
$('#onCancelBut').click(function(){
	$('#onInputDiv').css('display','block')
	$('#reserveInforDiv').css('display','none')
})

$('#onCheckBut').click(function(){
	data={'orderId':$('#onOrderId').text(),'phone':$('#resPhone').val(),'idCardNo':$('#resIdCardNo').val(),
			'zcomment':$('#resComment').val()
	}
	$.post("/hotel/checkIn/onlineCheck",data,function(str){
		//alert(str)
		var res=eval('(' +str + ')')
		if(res.code!=0){
			alert(res.message)
			//refreshTypeList()
			return;
		}else{
			window.location.href="/hotel/system/mainPage"
		}
		})
	})
</script>


